'''
补卡管理页面测试
'''
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage


class RemedyClock(KeyWords):
    url = KeyWords.url + 'attendancesManagement/attendancesStatistical'

    def remedy_clock_list_by_status(self):
        '''
        根据审批状态筛选补卡
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\attendance\remedyClock\remedy_clock_list_by_status.yaml')
        element_operation(self, data[0]['data'])

    def remedy_clock_list_by_time(self):
        '''
        根据时间筛选补卡列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\attendance\remedyClock\remedy_clock_list_by_time.yaml')
        element_operation(self, data[0]['data'])

    def remedy_clock_search(self):
        '''
        搜索补卡
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\attendance\remedyClock\remedy_clock_search.yaml')
        element_operation(self, data[0]['data'])

    def remedy_clock_detail(self):
        '''
        查看外勤详情
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\attendance\remedyClock\remedy_clock_detail.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobekq1', 'kobe8888')
        case = RemedyClock(driver)
        case.remedy_clock_detail()
        driver.quit()
    except Exception as E:
        print(E)
        driver.quit()
